﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Applay.Web
{
    public class UnauthorizedExceptionFilter : IExceptionFilter
    {
        public void OnException(ExceptionContext filterContext)
        {
            if (filterContext.Exception is UnauthorizedException)
            {
                filterContext.Result = new HttpUnauthorizedResult(filterContext.Exception.Message);
                filterContext.ExceptionHandled = true;
            }
        }
    }
}
